package com.example.sangong.resp;

import com.example.sangong.entity.Attachment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel("附件返回实体")
public class AttachmentUploadRsp {
    @ApiModelProperty(value = "文件名称", required = true, example = "a.png")
    private String fileName;
    @ApiModelProperty(value = "附件id", required = true, example = "243432423532432")
    private Long attachmentId;

    public static  AttachmentUploadRsp convert(Attachment attachment){
        AttachmentUploadRsp attachmentUploadRsp = new AttachmentUploadRsp();
        attachmentUploadRsp.setAttachmentId(attachment.getId());
        attachmentUploadRsp.setFileName(attachment.getOrginalName());
        return attachmentUploadRsp;
    }
}
